#ifndef RENDERINFOCOMPONENT_H
#define RENDERINFOCOMPONENT_H
#include "StompedReality/Core.h"
#include "StompedReality/Core/Component.h" // Base class: stomped_reality::entity_system::Component
#include "StompedReality/Core/Graphics/RenderGroup.h"
#include "StompedReality/Math/Vector2.h"
#include <vector>

StaticRegDummy( RenderInfoComponent )

namespace StompedReality
{
namespace Graphics
{
class RenderFunction;
namespace Functions
{
class TranslateRotate;
}
}
namespace components
{

struct RenderInfoComponentReg
{
  static int registeType( );
};

/*!
 * \author	Stefan Kazalski
 *
 * \brief	Render info component.
 *
 *    Stores global render infos:
 *     - Translation
 *     - Rotation
 *     - Layer
 *     - Render functions.
 */
class DLL_EXPORT RenderInfoComponent : public StompedReality::Core::Component
{
  friend struct RenderInfoComponentReg;

 protected:

  char m_Layer;
  float m_Depth;
  StompedReality::Math::Vector2 m_Translation;
  float m_Rotation;

  StompedReality::Graphics::RenderGroup m_RenderGroup;

  void CopyRenderData ( StompedReality::Graphics::Functions::TranslateRotate* fObject );

 public:

  //! \brief	Constructor.
  RenderInfoComponent( );

  //! \brief	Destructor.
  ~RenderInfoComponent( );

 public:

  //! \brief	Exectuted after creation
  void OnCreation( );

  //! \brief	Exectuted before destruction
  void OnDestruction( );

  //! \brief	Exectuted afte values read by TypeSystem.
  //!			Initialzies the component.
  //! \param	constructionHelper The contruction helper.
  void InitializeComponent( StompedReality::Core::ComponentConstuctionHelper* constructionHelper );

  //! \brief	Draw function.
  //!   Sends the render information to the renderer.
  void Draw( );

  //! \brief      Update.
  void Update ( );

  //! \brief	Processes a message.
  //! \param	msg The message.
  bool ProcessMessage ( StompedReality::Core::Message* msg );

  //! \brief	Add render function.
  //!			Adds render function to its render group
  void AddRenderFunction ( StompedReality::Graphics::RenderFunction* function );

  //! \brief	Sort render functions.
  //!			Sorts render function in its render group
  void SortRenderFunctions ( );

  StompedReality::Math::Vector2 GetTranslation( );
  void SetTranslation ( StompedReality::Math::Vector2 translation );
  float GetRotation( );
  void SetRotation ( float rotation );
  char GetLayer( );
  void SetLayer ( char layer );
  float GetDepth( );
  void SetDepth( float depth );
};

}
}
#endif // RENDERINFOCOMPONENT_H
